<template>
  <div class="my-data">
    <NavBar :title="title" />
    <div class="content-top">
      <MyEmpty v-if="loading === false && list.length === 0" />
      <van-list v-model="loading" :finished="!loading" @load="onLoad" v-else>
        <div class="list-item" v-for="(item, index) in list" :key="index">
          <div class="item-show" @click="onJobClick(item.jobid)">
            <p>
              <span>{{ item.jobname }}</span>
              <span>{{ item.viewdate }}</span>
            </p>
            <p>
              <span>{{ item.companyname }}</span>
            </p>
          </div>
        </div>
      </van-list>
    </div>
  </div>
</template>

<script>
import { PersonLoginedGetMyViewJobList } from "@/util/http";
import NavBar from "@/components/NavBar.vue";
import MyEmpty from "@/components/MyEmpty.vue";
import { List } from "vant";
import { mixin_person_toJobCompany } from "@/mixin/mixins";
export default {
  name: "ViewJobHis",
  components: {
    NavBar,
    MyEmpty,
    [List.name]: List,
  },
  props: ["title"],
  mixins: [mixin_person_toJobCompany],
  mounted() {
    this.onLoad();
  },
  // 定义属性
  data() {
    return {
      list: [],
      loading: true,
    };
  },
  // 方法集合
  methods: {
    async onLoad() {
      this.loading = true;
      await PersonLoginedGetMyViewJobList().then((res) => {
        // console.log(res);
        this.loading = false;
        this.list = res;
      });
    },
  },
};
</script>

<style lang="less">
@import "vant/lib/dialog/index.less";
@import "@/assets/css/common.less";
@import "@/assets/css/person-my-job-list.css";
</style>
